<?php
use yii\helpers\Html;
use yii\helpers\Url;

/* @var $this \yii\web\View */
/* @var $content string */
?>

<header class="main-header">

    <?= Html::a('<span class="logo-mini">APP</span><span class="logo-lg">' . Yii::$app->name . '</span>', Yii::$app->homeUrl, ['class' => 'logo']) ?>

    <nav class="navbar navbar-static-top" role="navigation">

        <a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
            <span class="sr-only">Toggle navigation</span>
        </a>

        <div class="navbar-custom-menu">


            <ul class="nav navbar-nav">

                <?php
                if (Yii::$app->user->identity != null) {

                    echo ' <li><a   href="' . Url::to(['site/index']) . '" >' . Yii::$app->user->identity->username . '</a></li>';
                    echo ' <li><a ';
                    echo ' href="' . Url::to(['site/logout']) . '" data-method="post">Sign out</a></li>';
                }else{
                    echo ' <li><a href="' . Url::to(['site/login']) . '" >Login</a></li>';
                    echo ' <li><a href="' . Url::to(['site/signup']) . '" >Sign Up</a></li>';
                }
                ?>
                <li>
                    <a href="/admin">后台</a>
                </li>

            </ul>
        </div>
    </nav>
</header>
